import { getTag, getLabel } from "@/api/artilce/tag.js";
const state = {
  tagList: [],
};

const mutations = {
  update(state, payload) {
    for (const key in payload) {
      state[key] = payload[key];
    }
  },
};

const actions = {
  //标签管理数据
  async getTag({ commit }, payload) {
    const result = await getTag();
    console.log("分类管理....", result.data);
    commit("update", {
      tagList: result.data,
    });
  },

  //添加标签管理数据
  async getLabel({ commit }, payload) {
    console.log(payload, "分界线");
    let { label, value } = payload;
    console.log(label, value);

    const result = await getLabel(payload);
    console.log(result);
  },
};

export default {
  namespaced: true,
  state,
  mutations,
  actions,
};
